Component({
  mixins: [],
  data: {
    winPrize:0,
    actionSCA:false,
    listAllwidth: 0,
    scleftValue: 0,
    aniSec: 0,
  },
  props: {

    bgImage:"",     //背景图片
    marqueeData:"",   //滚动数据
    contenWidth:"",   //滚动内容的宽度
    contenPosi:"",    //滚动内容的位置

  },
  didMount() {

    console.log(this.props);
    this.load();
    
  },
  didUpdate() {},
  didUnmount() {},
  methods: {

    load(){

      this.setData({ winPrize: this.props.marqueeData });
      let allliwidth = 0
      this.data.winPrize.map(v => {
        allliwidth += (9 * 24)  //24为字体大小
        allliwidth += (20 * 3)  //这是3块margin-right
        allliwidth += v.gift_name.length * 24
      })
      this.setData({ listAllwidth: allliwidth, scleftValue: allliwidth, aniSec: Math.ceil(allliwidth / 100) })
      let initobj;
      setTimeout(() => {
        clearInterval(initobj)
        this.setData({ actionSCA: true })
        initobj = setInterval(() => {
          this.setData({ aniSec: 0, scleftValue: -this.props.contenWidth })
          setTimeout(() => {
            this.setData({ aniSec: Math.ceil(this.data.listAllwidth / 100), scleftValue: this.data.listAllwidth })
          }, 200)
        }, Math.ceil(this.data.listAllwidth / 100) * 1000 + 200)
      }, 200)

   
    }

  },
});
